import Vue from "vue";
import Router from "vue-router";
import Home from "@/view/Home";
import Item from "@/view/Item";
import MoreData from "@/view/MoreData";
import RealTimeHome from '@/view/RealTimeHome.vue';

Vue.use(Router);
//获取原型对象上的push函数
const originalPush = Router.prototype.push;
//修改原型对象中的push方法
Router.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err);
};

export const constantRouterMap = [
	{
		path: '/',
		name: 'Home',
		component: Home,
		// redirect: '/Home',
	},
	{
		path: '/Item',
		name: 'Item',
		component: Item
	},
	{
		path: '/RealTimeHome',
		name: 'RealTimeHome',
		component: RealTimeHome,
	},
	{
		path: "/MoreData",
		name: "MoreData",
		component: MoreData
	},
]

export default new Router({
	mode: 'history', //后端支持可开
	// base: '/kylin/',
	scrollBehavior: () => ({
		y: 0
	}),
	routes: constantRouterMap
});
